package com.pkk.penguin.frame.know.java.driven.ext.listener.listener;

import com.pkk.penguin.frame.know.java.driven.ext.listener.event.MyEvent1;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * 事件监听的另一种方式
 *
 * @author peikunkun
 * @version V1.0
 * @date 2020-11-16 14:21
 **/
@Service
public class MyEventListener {


  /**
   * 注解形式的事件监听
   *
   * @return void
   * @Param event
   * @author peikunkun
   * @date 2020/11/16 0016 下午 2:22
   * @since
   */

  @EventListener(classes = {MyEvent1.class})
  public void eventListener(ApplicationEvent event) {
    System.out.println(this.getClass().getSimpleName() + "【********1】 触发事件监听,将会进行监听事件" + event);
  }

}
